//
//  Unit.h
//  Hello Cocos
//
//  Created by Tedo on 6/13/10.
//  Copyright 2010 sushigames. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "cocos2d.h"

typedef enum {
	ATTACK,
	IDLE,
	MOVE,
	DEAD
} UnitState;

typedef enum {
	NORMAL, //0
	HEAL	//1
} AttackType;

@interface Unit : CCSprite {
	UITouch *touch;
	CGPoint desiredPosition;
	Unit *attackTarget;
	float attackElapsed;
	UnitState state;
	
	NSString *name;
	NSArray *affinityYield;
	NSArray *affinityRequirements;
	AttackType attackType;
	float attackRange;
	float attackDamage;
	float attackSpeed;
	float moveSpeed;
	float moveSpeedInCombat;
	float maxHealth;
	float health;
}

+(NSMutableArray *) allUnits;
+(NSMutableArray *) allUnitsNotDead;
+(void)track: (Unit *)aUnit;
+(void)untrack: (Unit *)aUnit;
+(void)clearAllUnits;
+(id)unitFromId: (NSString *)identifier;

-(void)changeStateTo:(UnitState)newState;
-(void)changeStateTo:(id)sender data:(UnitState)newState;
-(void)damaged: (float)damage;

-(void)debugRetainCount;

@property (nonatomic, retain) UITouch *touch;
@property CGPoint desiredPosition;
@property (nonatomic, retain) Unit *attackTarget;
@property float attackElapsed;
@property UnitState state;

@property (nonatomic, retain) NSString *name;
@property (nonatomic, retain) NSArray *affinityYield;
@property (nonatomic, retain) NSArray *affinityRequirements;
@property AttackType attackType;
@property float attackRange;
@property float attackDamage;
@property float attackSpeed;
@property float moveSpeed;
@property float moveSpeedInCombat;
@property float maxHealth;
@property float health;

@end
